import Vue from 'vue'
import App from './App.vue'
import "amfe-flexible"
// 引入css样式
import "./assets/css/reset.css"
// 路由器模块
import router from './router/index'
// ui组件
import ElementUI from "element-ui"
import "element-ui/lib/theme-chalk/index.css"
Vue.use(ElementUI)
// 引入vuex的store
import store from "@/vuex/store.js"
Vue.config.productionTip = false


// 处理路由重复点击报错问题
import VueRouter from "vue-router"

const originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location,onResolve,onReject){
  if(onResolve || onReject) return originPush.call(this,location,onResolve,onReject)
  return originPush.call(this,location).catch(err=>err)
}

const originReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location,onResolve,onReject){
  if(onResolve || onReject) return originReplace.call(this,location,onResolve,onReject)
  return originReplace.call(this,location).catch(err=>err);
}

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
